<template>
<el-dialog title="审核" :visible.sync="dialogVisible" width="90%">
    <el-form ref="form" :model="formline" label-width="130px" label-suffix=":">
        <el-row :gutter="20">
            <el-col :span="12">
                <el-form-item label="客户编号">
                    {{ formline.customerNo }}
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="客户类型">
                    <dict-tag :options="dict.type[formline.categoryId]" :value="formline.subCategoryId"/>
                </el-form-item>
            </el-col>
            <el-col :span="24">
                <el-form-item label="客户全称">{{  formline.customerName  }}</el-form-item>
            </el-col>

            <el-col :span="8">
                <el-form-item label="服务团队">{{ formline.serviceGroupName}} </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="客户负责律师">{{ formline.lawyerName }} </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="客户状态">
                    <dict-tag :options="dict.type.customer_state" :value="formline.state"/>
                </el-form-item>
            </el-col>

            <el-form-item label="关联单位">
                <el-table :data="formline.associatedUnits">
                    <el-table-column prop="date" label="日期">
                    </el-table-column>
                    <el-table-column prop="name" label="名称">
                    </el-table-column>
                    <el-table-column prop="address" label="地址">
                    </el-table-column>
                </el-table>
            </el-form-item>
            <el-form-item label="简介">
                {{ formline.introduction }}
            </el-form-item>
            <!-- 客户类型 -->
            <template v-if="type == 1">
                <!-- <el-col :span="8">
                    <el-form-item label="统一社会信用代码">
                        {{ formline.idType }}
                    </el-form-item>
                </el-col> -->
                <el-col :span="8">
                    <el-form-item label="法定代表/负责人">
                        {{ formline.legalPerson }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="单位传真">
                        {{ formline.fax }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="单位电话">
                        {{ formline.tel }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="单位地址">
                        {{ formline.address }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="邮编">
                        {{ formline.postCode }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="开户行">
                        {{ formline.bankName }}
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="银行账号">
                        {{ formline.bankAccount }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="所属地区">
                        <dict-tag :options="dict.type.customer_region" :value="formline.region"/>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="人员规模">
                        <dict-tag :options="dict.type.company_scale" :value="formline.scale"/>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="单位网址">
                        {{ formline.text }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="所属行业">
                        <dict-tag :options="dict.type.customer_industry" :value="formline.industry"/>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="注册资本(万元)">
                        {{ formline.registeredCapital }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="年营业额(万元)">
                        {{ formline.annualTurnover }}
                    </el-form-item>
                </el-col>
            </template>
            <!-- 自然人 -->
            <template v-else>
                <el-form-item label="联系人">
                    <el-col :span="8">
                        <el-form-item label="手机">
                            {{ formline.mobile }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="固话">
                            {{ formline.telphone }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="Email">
                            {{ formline.email }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="微信号">
                            {{ formline.wechat }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="QQ">
                            {{ formline.qq }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="邮编">
                            {{ formline.postCode }}
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="通信地址">
                            {{ formline.address }}
                        </el-form-item>
                    </el-col>
                </el-form-item>
                <el-col :span="8">
                    <el-form-item label="性别">
                        <dict-tag :options="dict.type.sex" :value="formline.gender"/>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="出生日期">
                        {{ formline.birthday }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="婚姻状况">
                        <dict-tag :options="dict.type.marital_status" :value="formline.maritalStatus"/>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="证件类型">
                        <dict-tag :options="dict.type.id_type" :value="formline.idType"/>
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="证件号码">
                        {{ formline.idNo }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="国籍">
                        <dict-tag :options="dict.type.basic_country" :value="formline.nationality"/>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="民族">
                        {{ formline.ethnicity }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="籍贯">
                        {{ formline.originPlace }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="开户行">
                        {{ formline.bankName }}
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="银行账号">
                        {{ formline.bankAccount }}
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="工作单位">
                        {{ formline.company }}
                    </el-form-item>
                </el-col>
                <el-col :span="16">
                    <el-form-item label="工作单位地址">
                        {{ formline.companyAddress }}
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="社会关系">
                        {{ formline.socialRelations }}
                    </el-form-item>
                </el-col>
            </template>
            <el-form-item :label="type == 1 ? '联系人' : '其他联系人'">
                <el-table v-if="type==1" :data="formline.linkmen">
                    <el-table-column prop="name" label="姓名">
                    </el-table-column>
                    <el-table-column prop="name" label="部门">
                    </el-table-column>
                    <el-table-column prop="address" label="职务">
                    </el-table-column>
                    <el-table-column prop="mobile" label="手机">
                    </el-table-column>
                    <el-table-column prop="tel" label="固话">
                    </el-table-column>
                    <el-table-column prop="address" label="Email">
                    </el-table-column>
                    <el-table-column prop="address" label="QQ">
                    </el-table-column>
                    <el-table-column prop="address" label="年龄范围">
                    </el-table-column>
                    <el-table-column prop="address" label="社会关系">
                    </el-table-column>
                </el-table>
                <el-table v-else>
                    <el-table-column prop="name" label="姓名">
                    </el-table-column>
                    <el-table-column prop="mobile" label="手机">
                    </el-table-column>
                    <el-table-column prop="tel" label="固话">
                    </el-table-column>
                    <el-table-column prop="email" label="Email">
                    </el-table-column>
                    <el-table-column prop="QQ" label="QQ">
                    </el-table-column>
                    <el-table-column prop="remark" label="备注">
                    </el-table-column>
                </el-table>
            </el-form-item>
            <el-form-item label="备注">{{ formline.remark }}</el-form-item>
            <el-form-item label="附件"></el-form-item>
            <el-form-item label="审核意见">
                <el-input placeholder="请输入" v-if="!islook" v-model.trim="dataForm.remark"></el-input>
                <span v-else>{{ dataForm.remark }}</span>
            </el-form-item>
            
        </el-row>
    </el-form>
    <div slot="footer">
        <el-button :disabled="!dataForm.remark" v-loading="loading"  @click="onSubmit(2)">拒绝</el-button>
        <el-button type="primary" v-loading="loading" :disabled="!dataForm.remark" @click="onSubmit(1)">通过</el-button>
    </div>
</el-dialog>
</template>

<script>
import { getDetail, audit } from "@/api/approval/customer.js"
export default {
    data() {
        return {
            formline: {},
            type: 1, // 1单位 2 个人
            dialogVisible: false,
            dataForm: {
                "auditStatus": 1,
                "id": 0,
                "remark": ""
            },
            islook: false,
            loading: false
        };
    },
    dicts: [
        "customer_region",
        'customer_state',
        "marital_status",
        "basic_country",
        "company_scale",
        "id_type",
        "category_id",
        "unit",
        "person",
        "customer_industry",
        "sex"
    ],
    prop: {
        Proptype: String
    },
    methods: {

        getDetail (id) {
            getDetail(id).then(res => {
                this.formline = res.data
            })
        },
        onSubmit (status) {
            this.loading = true
            this.dataForm.auditStatus = status
            audit(this.dataForm).then(res => {
                this.$message.success("保存成功")
                this.$$parent.getList()
                this.loading = false
            }).catch(err => {
                this.loading = false
            })
        },
        init (id, islook = false) {
            this.dataForm.id = id
            this.dataForm.remark = ""
            this.dialogVisible = true
            this.islook = islook
            this.getDetail(id)
        }
    },
    mounted () {
        
    }
};
</script>

<style>
</style>